export function GetLists(){
    const self = this
    const _getEditHidden = function(params, self) {
        return params.row.wfStatus == 3 || self.fromPage == 'Summary'
    }
    let list = [
      {
        type: "selection",
        width: 45,
        align: "center"
      },
      {
          title: '业务单元',
          key: "trgNode",
      },
      {
          title: '二级组织',
          key: "company",
          // width: 300,

      },
      {
          title: '三级组织',
          key: "dpt",
          // width: 300,
      },
      {
          title: '最近更新时间',
          key:'updateTime',
         minWidth: 180,
           //width: 300,
      },
      {
        title: '状态',
        key: "wfStatusName",
         //width: 300,
         render: (h, params) => {
          return h('div',
          [
            h('p', {
              style:{
                display: 'inline-block',
                maxWidth: '80px',
                overflow: 'hidden', 
                textOverflow: 'ellipsis',
                whiteSpace: 'nowrap',
                color: params.row.wfStatusName == '驳回' ? '#E23928' : ''
              },
             }, params.row.wfStatusName),
            h('Tooltip', {
              props: {
                // trigger: "hover",
                transfer: true,
                placement:"left-end",
                maxWidth: '1000',
                content: '审批意见：' + ((params.row.approverComments == null || params.row.approverComments == '') ? '--' : params.row.approverComments)
              },
              style: {
                  // float: "right",
                  // backgroundColor: 'red'
                }
            }, [
                h('Icon', {
                  props: {
                    type: (!['审核通过', '驳回'].includes(params.row.wfStatusName) || (params.row.approverComments == null || params.row.approverComments == '')) ? '' : 'ios-book-outline'
                  },
                  style: {
                    fontSize: '18px',
                    position: 'relative',
                    top: '-5px',
                    left: '5px',
                    color: params.row.wfStatusName == '驳回' ? '#E23928' : ''
                  },
                })
              ])
          ])
        }
      },
      {
          title: '操作',
          align: "left",
          fixed: "right",
          width: 160,
          render: (h, params) => {
              return h("RowTools", {
                  props: {
                  data: [
                      {
                        type: "text",
                        text: '详情',

                        handle: () => {
                            this.goDetail(params.row);
                        }
                      },
                      {
                        type: "text",
                        text: '编辑',
                        hidden: _getEditHidden(params, self),
                        handle: () => {
                            this.goEdit(params.row);
                        }
                      },
                      {
                        type: "text",
                        text: '修订记录',
                        handle: () => {
                          this.revisionRecord(params.row);
                        }
                      }
                      // {
                      //   type: "text",
                      //   text: '导出',
                      //   hidden: !params.row.wfStatus || params.row.wfStatus == 2,
                      //   handle: () => {
                      //     this.exportFun(params.row);
                      //   }
                      // },
                      //   {
                      //   type: "text",
                      //   text: '删除',
                      //   hidden: (params.row.wfStatus && params.row.wfStatus != 1),
                      //   handle: () => {
                      //     this.deleteFun(params.row);
                      //   }
                      // }
                  ]
                  }
              });
          }
      }
  ]
  if (this.fromPage !== 'creater') {
    // 数据管理页进入 删除复选框
    list.forEach((e, i) => {
      if(e.type == 'selection') {
        list.splice(i,1)
      }
    })
    // 删除状态
    list.forEach((e, i) => {
      if(e.key == 'wfStatusName') {
        list.splice(i,1)
      }
    })
  }
  return list
}

// 目标表
export function GetLists2(){
  // const self = this
  // const _getEditHidden = function(params, self) {
  //     return params.row.wfStatus == 3 || self.fromPage == 'Summary'
  // }
  let list = [
    {
      type: "selection",
      width: 45,
      align: "center"
    },
    {
      title: '业务单元',
      key: "trgNode",
    },
    {
      title: '目标年度',
      key: "reportCycle",
    },
    {
      title: '更新时间',
      key:'updateTime',
      minWidth: 180,
         //width: 300,
    },
    {
      title: '创建时间',
      key:'createTime',
      minWidth: 180,
       //width: 300,
    },
    {
        title: '操作',
        align: "left",
        fixed: "right",
        width: 160,
        render: (h, params) => {
            return h("RowTools", {
                props: {
                data: [
                    {
                      type: "text",
                      text: '详情',

                      handle: () => {
                          this.goDetail(params.row);
                      }
                    },
                    {
                      type: "text",
                      text: '导出',
                      handle: () => {
                        this.exportFun(params.row);
                      }
                    }
                ]
                }
            });
        }
    }
]
return list
}

export const columnList = [
  { columnName: '编码', columnKey: 'taskCode' },
  { columnName: '业务单元', columnKey: 'trgNode' },
  { columnName: '二级组织', columnKey: 'company', disabled: true },
  { columnName: '三级组织', columnKey: 'dpt', disabled: true },
  { columnName: '最近更新时间', columnKey: 'updateTime', minWidth: 160 },
  { columnName: '创建时间', columnKey: 'createTime', minWidth: 160 },
  { columnName: '状态', columnKey: 'wfStatusName',
    render: (h, params) => {
      return h('div',
      [
        h('p', {
          style:{
            display: 'inline-block',
            maxWidth: '80px',
            overflow: 'hidden', 
            textOverflow: 'ellipsis',
            whiteSpace: 'nowrap',
            color: params.row.wfStatusName == '驳回' ? '#E23928' : ''
          },
        }, params.row.wfStatusName),
        h('Tooltip', {
          props: {
            // trigger: "hover",
            transfer: true,
            placement:"top",
            maxWidth: '1000',
            content: '审批意见：' + ((params.row.approverComments == null || params.row.approverComments == '') ? '--' : params.row.approverComments)
            // ontent: '审批意见：' + params.row.approverComments
          },
          style: {
              // float: "right",
              // backgroundColor: 'red'
            }
        }, [
            h('Icon', {
              props: {
                // type: (params.row.wfStatusName == '审核通过' || params.row.wfStatusName == '驳回') ? 'ios-book-outline' : ''
                type: (!['审核通过', '驳回'].includes(params.row.wfStatusName) || (params.row.approverComments == null || params.row.approverComments == '')) ? '' : 'ios-book-outline'
              },
              style: {
                fontSize: '18px',
                position: 'relative',
                top: '-5px',
                left: '5px',
                color: params.row.wfStatusName == '驳回' ? '#E23928' : ''
              },
            })
          ])
      ])
    }
  }
]
